//
//  NhacVietViewController.m
//  NhomThuy
//
//  Created by Lam Quoc on 1/27/15.
//  Copyright (c) 2015 t3h. All rights reserved.
//

#import "NhacVietViewController.h"
#import "NhacVietTableViewCell.h"
#import "ManagerData.h"

@interface NhacVietViewController ()

@end
//NSMutableDictionary* nhacVietDic;
//NSMutableArray* nhacvietArray;
@implementation NhacVietViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.nhacVietTableView.delegate=self;
    self.nhacVietTableView.dataSource=self;
    NSLog(@"%lu",(unsigned long)[ManagerData defaultManager].vnSongList.count);
    
//    nhacvietArray = [[NSMutableArray alloc] init];
//    nhacvietArray = [ManagerData defaultManager].vnSongList ;
//    NSLog(@"%lu",(unsigned long)nhacvietArray.count);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - TableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return [ManagerData defaultManager].vnSongList.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString* myIDindentifier =@"nhacvietID";
    NhacVietTableViewCell* cell = nil;
    cell = [tableView dequeueReusableCellWithIdentifier:myIDindentifier];
    if (cell==nil) {
        [tableView registerClass:[NhacVietTableViewCell class] forCellReuseIdentifier:myIDindentifier];
        cell = [tableView dequeueReusableCellWithIdentifier:myIDindentifier];
    }
    
    NSDictionary* myDic  = [ManagerData defaultManager].vnSongList[indexPath.row];

    cell.maBaiHat.text=[myDic objectForKey:@"song-code"] ;
    cell.loiBaiHat.text=[[myDic objectForKey:@"song-name"]capitalizedString];
    cell.noidungBaiHat.text=[myDic objectForKey:@"lyrics"];
    
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 79;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 85;
}
-(void)viewWillAppear:(BOOL)animated{
    [UINavigationBar appearance];
    [self.navigationController.navigationBar setBarTintColor:[[ManagerData defaultManager] setBackgroundColorForNavi]];
    [self.navigationController.navigationBar setTintColor:[[ManagerData defaultManager] setTintColorForNavi]];
    self.navigationItem.titleView = [[ManagerData defaultManager]setImageTitleForNavi];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
